home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / xemacs.info-11.z / xemacs.info-11
Encoding:
GNU Info File  |  1998-05-21  |  49.4 KB  |  1,183 lines

  1. This is Info file ../../info/xemacs.info, produced by Makeinfo version
  2. 1.68 from the input file xemacs.texi.
  3.  
  4.    This file documents the XEmacs editor.
  5.  
  6.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
  7. 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
  8. Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
  9.  
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.  
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided also
  16. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  17. General Public License" are included exactly as in the original, and
  18. provided that the entire resulting derived work is distributed under the
  19. terms of a permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions, except that the sections entitled "The GNU Manifesto",
  24. "Distribution" and "GNU General Public License" may be included in a
  25. translation approved by the author instead of in the original English.
  26.  
  27. 
  28. File: xemacs.info,  Node: Select Tags Table,  Next: Find Tag,  Prev: Create Tags Table,  Up: Tags
  29.  
  30. Selecting a Tags Table
  31. ----------------------
  32.  
  33.    At any time Emacs has one "selected" tags table, and all the commands
  34. for working with tags tables use the selected one.  To select a tags
  35. table, use the variable `tag-table-alist'.
  36.  
  37.    The value of `tag-table-alist' is a list that determines which
  38. `TAGS' files should be active for a given buffer.  This is not really
  39. an association list, in that all elements are checked.  The car of each
  40. element of this list is a pattern against which the buffers file name
  41. is compared; if it matches, then the cdr of the list should be the name
  42. of the tags table to use.  If more than one element of this list
  43. matches the buffers file name, all of the associated tags tables are
  44. used.  Earlier ones are searched first.
  45.  
  46.    If the car of elements of this list are strings, they are treated as
  47. regular-expressions against which the file is compared (like the
  48. `auto-mode-alist').  If they are not strings, they are evaluated.  If
  49. they evaluate to non-`nil', the current buffer is considered to match.
  50.  
  51.    If the cdr of the elements of this list are strings, they are
  52. assumed to name a tags file.  If they name a directory, the string
  53. `tags' is appended to them to get the file name.  If they are not
  54. strings, they are evaluated and must return an appropriate string.
  55.  
  56.    For example:
  57.  
  58.        (setq tag-table-alist
  59.          '(("/usr/src/public/perl/" . "/usr/src/public/perl/perl-3.0/")
  60.            ("\\.el$" . "/usr/local/emacs/src/")
  61.            ("/jbw/gnu/" . "/usr15/degree/stud/jbw/gnu/")
  62.            ("" . "/usr/local/emacs/src/")
  63.            ))
  64.  
  65.    The example defines the tags table alist in the following way:
  66.  
  67.    * Anything in the directory `/usr/src/public/perl/' should use the
  68.      `TAGS' file `/usr/src/public/perl/perl-3.0/TAGS'.
  69.  
  70.    * Files ending in `.el' should use the `TAGS' file
  71.      `/usr/local/emacs/src/TAGS'.
  72.  
  73.    * Anything in or below the directory `/jbw/gnu/' should use the
  74.      `TAGS' file `/usr15/degree/stud/jbw/gnu/TAGS'.
  75.  
  76.    If you had a file called `/usr/jbw/foo.el', it would use both `TAGS'
  77. files,
  78. `/usr/local/emacs/src/TAGS' and `/usr15/degree/stud/jbw/gnu/TAGS' (in
  79. that order), because it matches both patterns.
  80.  
  81.    If the buffer-local variable `buffer-tag-table' is set, it names a
  82. tags table that is searched before all others when `find-tag' is
  83. executed from this buffer.
  84.  
  85.    If there is a file called `TAGS' in the same directory as the file
  86. in question, then that tags file will always be used as well (after the
  87. `buffer-tag-table' but before the tables specified by this list).
  88.  
  89.    If the variable `tags-file-name' is set, the `TAGS' file it names
  90. will apply to all buffers (for backwards compatibility.)  It is searched
  91. first.
  92.  
  93.    If the value of the variable `tags-always-build-completion-table' is
  94. `t', the tags file will always be added to the completion table without
  95. asking first, regardless of the size of the tags file.
  96.  
  97.    The function `M-x visit-tags-table', is largely made obsolete by the
  98. variable `tag-table-alist', tells tags commands to use the tags table
  99. file FILE first.  The FILE should be the name of a file created with
  100. the `etags' program.  A directory name is also acceptable; it means the
  101. file `TAGS' in that directory.  The function only stores the file name
  102. you provide in the variable `tags-file-name'.  Emacs does not actually
  103. read in the tags table contents until you try to use them.  You can set
  104. the variable explicitly instead of using `visit-tags-table'.  The value
  105. of the variable `tags-file-name' is the name of the tags table used by
  106. all buffers.  This is for backward compatibility, and is largely
  107. supplanted by the variable `tag-table-alist'.
  108.  
  109. 
  110. File: xemacs.info,  Node: Find Tag,  Next: Tags Search,  Prev: Select Tags Table,  Up: Tags
  111.  
  112. Finding a Tag
  113. -------------
  114.  
  115.    The most important thing that a tags table enables you to do is to
  116. find the definition of a specific tag.
  117.  
  118. `M-. TAG &OPTIONAL OTHER-WINDOW'
  119.      Find first definition of TAG (`find-tag').
  120.  
  121. `C-u M-.'
  122.      Find next alternate definition of last tag specified.
  123.  
  124. `C-x 4 . TAG'
  125.      Find first definition of TAG, but display it in another window
  126.      (`find-tag-other-window').
  127.  
  128.    `M-.' (`find-tag') is the command to find the definition of a
  129. specified tag.  It searches through the tags table for that tag, as a
  130. string, then uses the tags table information to determine the file in
  131. which the definition is used and the approximate character position of
  132. the definition in the file.  Then `find-tag' visits the file, moves
  133. point to the approximate character position, and starts searching
  134. ever-increasing distances away for the text that should appear at the
  135. beginning of the definition.
  136.  
  137.    If an empty argument is given (by typing <RET>), the sexp in the
  138. buffer before or around point is used as the name of the tag to find.
  139. *Note Lists::, for information on sexps.
  140.  
  141.    The argument to `find-tag' need not be the whole tag name; it can be
  142. a substring of a tag name.  However, there can be many tag names
  143. containing the substring you specify.  Since `find-tag' works by
  144. searching the text of the tags table, it finds the first tag in the
  145. table that the specified substring appears in.  To find other tags that
  146. match the substring, give `find-tag' a numeric argument, as in `C-u
  147. M-.'.  This does not read a tag name, but continues searching the tag
  148. table's text for another tag containing the same substring last used.
  149. If your keyboard has a real <META> key, `M-0 M-.' is an easier
  150. alternative to `C-u M-.'.
  151.  
  152.    If the optional second argument OTHER-WINDOW is non-`nil', it uses
  153. another window to display the tag.  Multiple active tags tables and
  154. completion are supported.
  155.  
  156.    Variables of note include the following:
  157.  
  158. `tag-table-alist'
  159.      Controls which tables apply to which buffers.
  160.  
  161. `tags-file-name'
  162.      Stores a default tags table.
  163.  
  164. `tags-build-completion-table'
  165.      Controls completion behavior.
  166.  
  167. `buffer-tag-table'
  168.      Specifies a buffer-local table.
  169.  
  170. `make-tags-files-invisible'
  171.      Sets whether tags tables should be very hidden.
  172.  
  173. `tag-mark-stack-max'
  174.      Specifies how many tags-based hops to remember.
  175.  
  176.    Like most commands that can switch buffers, `find-tag' has another
  177. similar command that displays the new buffer in another window.  `C-x 4
  178. .' invokes the function `find-tag-other-window'.  (This key sequence
  179. ends with a period.)
  180.  
  181.    Emacs comes with a tags table file `TAGS' (in the directory
  182. containing Lisp libraries) that includes all the Lisp libraries and all
  183. the C sources of Emacs.  By specifying this file with `visit-tags-table'
  184. and then using `M-.' you can quickly look at the source of any Emacs
  185. function.
  186.  
  187. 
  188. File: xemacs.info,  Node: Tags Search,  Next: List Tags,  Prev: Find Tag,  Up: Tags
  189.  
  190. Searching and Replacing with Tags Tables
  191. ----------------------------------------
  192.  
  193.    The commands in this section visit and search all the files listed
  194. in the selected tags table, one by one.  For these commands, the tags
  195. table serves only to specify a sequence of files to search.  A related
  196. command is `M-x grep' (*note Compilation::.).
  197.  
  198. `M-x tags-search <RET> REGEXP <RET>'
  199.      Search for REGEXP through the files in the selected tags table.
  200.  
  201. `M-x tags-query-replace <RET> REGEXP <RET> REPLACEMENT <RET>'
  202.      Perform a `query-replace-regexp' on each file in the selected tags
  203.      table.
  204.  
  205. `M-,'
  206.      Restart one of the commands above, from the current location of
  207.      point (`tags-loop-continue').
  208.  
  209.    `M-x tags-search' reads a regexp using the minibuffer, then searches
  210. for matches in all the files in the selected tags table, one file at a
  211. time.  It displays the name of the file being searched so you can
  212. follow its progress.  As soon as it finds an occurrence, `tags-search'
  213. returns.
  214.  
  215.    Having found one match, you probably want to find all the rest.  To
  216. find one more match, type `M-,' (`tags-loop-continue') to resume the
  217. `tags-search'.  This searches the rest of the current buffer, followed
  218. by the remaining files of the tags table.
  219.  
  220.    `M-x tags-query-replace' performs a single `query-replace-regexp'
  221. through all the files in the tags table.  It reads a regexp to search
  222. for and a string to replace with, just like ordinary `M-x
  223. query-replace-regexp'.  It searches much like `M-x tags-search', but
  224. repeatedly, processing matches according to your input.  *Note
  225. Replace::, for more information on query replace.
  226.  
  227.    It is possible to get through all the files in the tags table with a
  228. single invocation of `M-x tags-query-replace'.  But often it is useful
  229. to exit temporarily, which you can do with any input event that has no
  230. special query replace meaning.  You can resume the query replace
  231. subsequently by typing `M-,'; this command resumes the last tags search
  232. or replace command that you did.
  233.  
  234.    The commands in this section carry out much broader searches than the
  235. `find-tag' family.  The `find-tag' commands search only for definitions
  236. of tags that match your substring or regexp.  The commands
  237. `tags-search' and `tags-query-replace' find every occurrence of the
  238. regexp, as ordinary search commands and replace commands do in the
  239. current buffer.
  240.  
  241.    These commands create buffers only temporarily for the files that
  242. they have to search (those which are not already visited in Emacs
  243. buffers).  Buffers in which no match is found are quickly killed; the
  244. others continue to exist.
  245.  
  246.    It may have struck you that `tags-search' is a lot like `grep'.  You
  247. can also run `grep' itself as an inferior of Emacs and have Emacs show
  248. you the matching lines one by one.  This works much like running a
  249. compilation; finding the source locations of the `grep' matches works
  250. like finding the compilation errors.  *Note Compilation::.
  251.  
  252.    If you wish to process all the files in a selected tags table, but
  253. `M-x tags-search' and `M-x tags-query-replace' are not giving you the
  254. desired result, you can use `M-x next-file'.
  255.  
  256. `C-u M-x next-file'
  257.      With a numeric argument, regardless of its value, visit the first
  258.      file in the tags table and prepare to advance sequentially by
  259.      files.
  260.  
  261. `M-x next-file'
  262.      Visit the next file in the selected tags table.
  263.  
  264. 
  265. File: xemacs.info,  Node: List Tags,  Prev: Tags Search,  Up: Tags
  266.  
  267. Tags Table Inquiries
  268. --------------------
  269.  
  270. `M-x list-tags'
  271.      Display a list of the tags defined in a specific program file.
  272.  
  273. `M-x tags-apropos'
  274.      Display a list of all tags matching a specified regexp.
  275.  
  276.    `M-x list-tags' reads the name of one of the files described by the
  277. selected tags table, and displays a list of all the tags defined in that
  278. file.  The "file name" argument is really just a string to compare
  279. against the names recorded in the tags table; it is read as a string
  280. rather than a file name.  Therefore, completion and defaulting are not
  281. available, and you must enter the string the same way it appears in the
  282. tag table.  Do not include a directory as part of the file name unless
  283. the file name recorded in the tags table contains that directory.
  284.  
  285.    `M-x tags-apropos' is like `apropos' for tags.  It reads a regexp,
  286. then finds all the tags in the selected tags table whose entries match
  287. that regexp, and displays the tag names found.
  288.  
  289. 
  290. File: xemacs.info,  Node: Fortran,  Next: Asm Mode,  Prev: Tags,  Up: Programs
  291.  
  292. Fortran Mode
  293. ============
  294.  
  295.    Fortran mode provides special motion commands for Fortran statements
  296. and subprograms, and indentation commands that understand Fortran
  297. conventions of nesting, line numbers, and continuation statements.
  298.  
  299.    Special commands for comments are provided because Fortran comments
  300. are unlike those of other languages.
  301.  
  302.    Built-in abbrevs optionally save typing when you insert Fortran
  303. keywords.
  304.  
  305.    Use `M-x fortran-mode' to switch to this major mode.  Doing so calls
  306. the value of `fortran-mode-hook' as a function of no arguments if that
  307. variable has a non-`nil' value.
  308.  
  309. * Menu:
  310.  
  311. * Motion: Fortran Motion.     Moving point by statements or subprograms.
  312. * Indent: Fortran Indent.     Indentation commands for Fortran.
  313. * Comments: Fortran Comments. Inserting and aligning comments.
  314. * Columns: Fortran Columns.   Measuring columns for valid Fortran.
  315. * Abbrev: Fortran Abbrev.     Built-in abbrevs for Fortran keywords.
  316.  
  317.    Fortran mode was contributed by Michael Prange.
  318.  
  319. 
  320. File: xemacs.info,  Node: Fortran Motion,  Next: Fortran Indent,  Prev: Fortran,  Up: Fortran
  321.  
  322. Motion Commands
  323. ---------------
  324.  
  325.    Fortran mode provides special commands to move by subprograms
  326. (functions and subroutines) and by statements.  There is also a command
  327. to put the region around one subprogram, which is convenient for
  328. killing it or moving it.
  329.  
  330. `C-M-a'
  331.      Move to beginning of subprogram
  332.      (`beginning-of-fortran-subprogram').
  333.  
  334. `C-M-e'
  335.      Move to end of subprogram (`end-of-fortran-subprogram').
  336.  
  337. `C-M-h'
  338.      Put point at beginning of subprogram and mark at end
  339.      (`mark-fortran-subprogram').
  340.  
  341. `C-c C-n'
  342.      Move to beginning of current or next statement (`fortran-next-
  343.      statement').
  344.  
  345. `C-c C-p'
  346.      Move to beginning of current or previous statement (`fortran-
  347.      previous-statement').
  348.  
  349. 
  350. File: xemacs.info,  Node: Fortran Indent,  Next: Fortran Comments,  Prev: Fortran Motion,  Up: Fortran
  351.  
  352. Fortran Indentation
  353. -------------------
  354.  
  355.    Special commands and features are available for indenting Fortran
  356. code.  They make sure various syntactic entities (line numbers, comment
  357. line indicators, and continuation line flags) appear in the columns
  358. that are required for standard Fortran.
  359.  
  360. * Menu:
  361.  
  362. * Commands: ForIndent Commands. Commands for indenting Fortran.
  363. * Numbers:  ForIndent Num.      How line numbers auto-indent.
  364. * Conv:     ForIndent Conv.     Conventions you must obey to avoid trouble.
  365. * Vars:     ForIndent Vars.     Variables controlling Fortran indent style.
  366.  
  367. 
  368. File: xemacs.info,  Node: ForIndent Commands,  Next: ForIndent Num,  Prev: Fortran Indent,  Up: Fortran Indent
  369.  
  370. Fortran Indentation Commands
  371. ............................
  372.  
  373. `<TAB>'
  374.      Indent the current line (`fortran-indent-line').
  375.  
  376. `M-<LFD>'
  377.      Break the current line and set up a continuation line.
  378.  
  379. `C-M-q'
  380.      Indent all the lines of the subprogram point is in
  381.      (`fortran-indent-subprogram').
  382.  
  383.    <TAB> is redefined by Fortran mode to reindent the current line for
  384. Fortran (`fortran-indent-line').  Line numbers and continuation markers
  385. are indented to their required columns, and the body of the statement
  386. is independently indented, based on its nesting in the program.
  387.  
  388.    The key `C-M-q' is redefined as `fortran-indent-subprogram', a
  389. command that reindents all the lines of the Fortran subprogram
  390. (function or subroutine) containing point.
  391.  
  392.    The key `M-<LFD>' is redefined as `fortran-split-line', a command to
  393. split a line in the appropriate fashion for Fortran.  In a non-comment
  394. line, the second half becomes a continuation line and is indented
  395. accordingly.  In a comment line, both halves become separate comment
  396. lines.
  397.  
  398. 
  399. File: xemacs.info,  Node: ForIndent Num,  Next: ForIndent Conv,  Prev: ForIndent Commands,  Up: Fortran Indent
  400.  
  401. Line Numbers and Continuation
  402. .............................
  403.  
  404.    If a number is the first non-whitespace in the line, it is assumed
  405. to be a line number and is moved to columns 0 through 4.  (Columns are
  406. always counted from 0 in XEmacs.)  If the text on the line starts with
  407. the conventional Fortran continuation marker `$', it is moved to column
  408. 5.  If the text begins with any non whitespace character in column 5,
  409. it is assumed to be an unconventional continuation marker and remains
  410. in column 5.
  411.  
  412.    Line numbers of four digits or less are normally indented one space.
  413. This amount is controlled by the variable `fortran-line-number-indent',
  414. which is the maximum indentation a line number can have.  Line numbers
  415. are indented to right-justify them to end in column 4 unless that would
  416. require more than the maximum indentation.  The default value of the
  417. variable is 1.
  418.  
  419.    Simply inserting a line number is enough to indent it according to
  420. these rules.  As each digit is inserted, the indentation is recomputed.
  421. To turn off this feature, set the variable
  422. `fortran-electric-line-number' to `nil'.  Then inserting line numbers
  423. is like inserting anything else.
  424.  
  425. 
  426. File: xemacs.info,  Node: ForIndent Conv,  Next: ForIndent Vars,  Prev: ForIndent Num,  Up: Fortran Indent
  427.  
  428. Syntactic Conventions
  429. .....................
  430.  
  431.    Fortran mode assumes that you follow certain conventions that
  432. simplify the task of understanding a Fortran program well enough to
  433. indent it properly:
  434.  
  435.    * Two nested `do' loops never share a `continue' statement.
  436.  
  437.    * The same character appears in column 5 of all continuation lines.
  438.      It is the value of the variable `fortran-continuation-char'.  By
  439.      default, this character is `$'.
  440.  
  441. If you fail to follow these conventions, the indentation commands may
  442. indent some lines unaesthetically.  However, a correct Fortran program
  443. will retain its meaning when reindented even if the conventions are not
  444. followed.
  445.  
  446. 
  447. File: xemacs.info,  Node: ForIndent Vars,  Prev: ForIndent Conv,  Up: Fortran Indent
  448.  
  449. Variables for Fortran Indentation
  450. .................................
  451.  
  452.    Several additional variables control how Fortran indentation works.
  453.  
  454. `fortran-do-indent'
  455.      Extra indentation within each level of `do' statement (the default
  456.      is 3).
  457.  
  458. `fortran-if-indent'
  459.      Extra indentation within each level of `if' statement (the default
  460.      is 3).
  461.  
  462. `fortran-continuation-indent'
  463.      Extra indentation for bodies of continuation lines (the default is
  464.      5).
  465.  
  466. `fortran-check-all-num-for-matching-do'
  467.      If this is `nil', indentation assumes that each `do' statement
  468.      ends on a `continue' statement.  Therefore, when computing
  469.      indentation for a statement other than `continue', it can save
  470.      time by not checking for a `do' statement ending there.  If this
  471.      is non-`nil', indenting any numbered statement must check for a
  472.      `do' that ends there.  The default is `nil'.
  473.  
  474. `fortran-minimum-statement-indent'
  475.      Minimum indentation for Fortran statements.  For standard Fortran,
  476.      this is 6.  Statement bodies are always indented at least this
  477.      much.
  478.  
  479. 
  480. File: xemacs.info,  Node: Fortran Comments,  Next: Fortran Columns,  Prev: Fortran Indent,  Up: Fortran
  481.  
  482. Comments
  483. --------
  484.  
  485.    The usual Emacs comment commands assume that a comment can follow a
  486. line of code.  In Fortran, the standard comment syntax requires an
  487. entire line to be just a comment.  Therefore, Fortran mode replaces the
  488. standard Emacs comment commands and defines some new variables.
  489.  
  490.    Fortran mode can also handle a non-standard comment syntax where
  491. comments start with `!' and can follow other text.  Because only some
  492. Fortran compilers accept this syntax, Fortran mode will not insert such
  493. comments unless you have specified to do so in advance by setting the
  494. variable `comment-start' to `"!"' (*note Variables::.).
  495.  
  496. `M-;'
  497.      Align comment or insert new comment (`fortran-comment-indent').
  498.  
  499. `C-x ;'
  500.      Applies to nonstandard `!' comments only.
  501.  
  502. `C-c ;'
  503.      Turn all lines of the region into comments, or (with arg) turn
  504.      them back into real code (`fortran-comment-region').
  505.  
  506.    `M-;' in Fortran mode is redefined as the command
  507. `fortran-comment-indent'.  Like the usual `M-;' command, it recognizes
  508. an existing comment and aligns its text appropriately.  If there is no
  509. existing comment, a comment is inserted and aligned.
  510.  
  511.    Inserting and aligning comments is not the same in Fortran mode as in
  512. other modes.  When a new comment must be inserted, a full-line comment
  513. is inserted if the current line is blank.  On a non-blank line, a
  514. non-standard `!' comment is inserted if you previously specified you
  515. wanted to use them.  Otherwise a full-line comment is inserted on a new
  516. line before the current line.
  517.  
  518.    Non-standard `!' comments are aligned like comments in other
  519. languages, but full-line comments are aligned differently.  In a
  520. standard full-line comment, the comment delimiter itself must always
  521. appear in column zero.  What can be aligned is the text within the
  522. comment.  You can choose from three styles of alignment by setting the
  523. variable `fortran-comment-indent-style' to one of these values:
  524.  
  525. `fixed'
  526.      The text is aligned at a fixed column, which is the value of
  527.      `fortran-comment-line-column'.  This is the default.
  528.  
  529. `relative'
  530.      The text is aligned as if it were a line of code, but with an
  531.      additional `fortran-comment-line-column' columns of indentation.
  532.  
  533. `nil'
  534.      Text in full-line columns is not moved automatically.
  535.  
  536.    You can also specify the character to be used to indent within
  537. full-line comments by setting the variable `fortran-comment-indent-char'
  538. to the character you want to use.
  539.  
  540.    Fortran mode introduces two variables `comment-line-start' and
  541. `comment-line-start-skip', which do for full-line comments what
  542. `comment-start' and `comment-start-skip' do for ordinary text-following
  543. comments.  Normally these are set properly by Fortran mode, so you do
  544. not need to change them.
  545.  
  546.    The normal Emacs comment command `C-x ;' has not been redefined.  It
  547. can therefore be used if you use `!' comments, but is useless in
  548. Fortran mode otherwise.
  549.  
  550.    The command `C-c ;' (`fortran-comment-region') turns all the lines
  551. of the region into comments by inserting the string `C$$$' at the front
  552. of each one.  With a numeric arg, the region is turned back into live
  553. code by deleting `C$$$' from the front of each line.  You can control
  554. the string used for the comments by setting the variable
  555. `fortran-comment-region'.  Note that here we have an example of a
  556. command and a variable with the same name; the two uses of the name
  557. never conflict because in Lisp and in Emacs it is always clear from the
  558. context which one is referred to.
  559.  
  560. 
  561. File: xemacs.info,  Node: Fortran Columns,  Next: Fortran Abbrev,  Prev: Fortran Comments,  Up: Fortran
  562.  
  563. Columns
  564. -------
  565.  
  566. `C-c C-r'
  567.      Displays a "column ruler" momentarily above the current line
  568.      (`fortran-column-ruler').
  569.  
  570. `C-c C-w'
  571.      Splits the current window horizontally so that it is 72 columns
  572.      wide.  This may help you avoid going over that limit
  573.      (`fortran-window-create').
  574.  
  575.    The command `C-c C-r' (`fortran-column-ruler') shows a column ruler
  576. above the current line.  The comment ruler consists of two lines of
  577. text that show you the locations of columns with special significance
  578. in Fortran programs.  Square brackets show the limits of the columns for
  579. line numbers, and curly brackets show the limits of the columns for the
  580. statement body.  Column numbers appear above them.
  581.  
  582.    Note that the column numbers count from zero, as always in XEmacs.
  583. As a result, the numbers may not be those you are familiar with; but the
  584. actual positions in the line are standard Fortran.
  585.  
  586.    The text used to display the column ruler is the value of the
  587. variable `fortran-comment-ruler'.  By changing this variable, you can
  588. change the display.
  589.  
  590.    For even more help, use `C-c C-w' (`fortran-window-create'), a
  591. command which splits the current window horizontally, resulting in a
  592. window 72 columns wide.  When you edit in this window, you can
  593. immediately see when a line gets too wide to be correct Fortran.
  594.  
  595. 
  596. File: xemacs.info,  Node: Fortran Abbrev,  Prev: Fortran Columns,  Up: Fortran
  597.  
  598. Fortran Keyword Abbrevs
  599. -----------------------
  600.  
  601.    Fortran mode provides many built-in abbrevs for common keywords and
  602. declarations.  These are the same sort of abbrevs that you can define
  603. yourself.  To use them, you must turn on Abbrev mode.  *note Abbrevs::..
  604.  
  605.    The built-in abbrevs are unusual in one way: they all start with a
  606. semicolon.  You cannot normally use semicolon in an abbrev, but Fortran
  607. mode makes this possible by changing the syntax of semicolon to "word
  608. constituent".
  609.  
  610.    For example, one built-in Fortran abbrev is `;c' for `continue'.  If
  611. you insert `;c' and then insert a punctuation character such as a space
  612. or a newline, the `;c' changes automatically to `continue', provided
  613. Abbrev mode is enabled.
  614.  
  615.    Type `;?' or `;C-h' to display a list of all built-in Fortran
  616. abbrevs and what they stand for.
  617.  
  618. 
  619. File: xemacs.info,  Node: Asm Mode,  Prev: Fortran,  Up: Programs
  620.  
  621. Asm Mode
  622. ========
  623.  
  624.    Asm mode is a major mode for editing files of assembler code.  It
  625. defines these commands:
  626.  
  627. `<TAB>'
  628.      `tab-to-tab-stop'.
  629.  
  630. `<LFD>'
  631.      Insert a newline and then indent using `tab-to-tab-stop'.
  632.  
  633. `:'
  634.      Insert a colon and then remove the indentation from before the
  635.      label preceding colon.  Then do `tab-to-tab-stop'.
  636.  
  637. `;'
  638.      Insert or align a comment.
  639.  
  640.    The variable `asm-comment-char' specifies which character starts
  641. comments in assembler syntax.
  642.  
  643. 
  644. File: xemacs.info,  Node: Running,  Next: Abbrevs,  Prev: Programs,  Up: Top
  645.  
  646. Compiling and Testing Programs
  647. ******************************
  648.  
  649.    The previous chapter discusses the Emacs commands that are useful for
  650. making changes in programs.  This chapter deals with commands that
  651. assist in the larger process of developing and maintaining programs.
  652.  
  653. * Menu:
  654.  
  655. * Compilation::        Compiling programs in languages other than Lisp
  656.                         (C, Pascal, etc.)
  657. * Modes: Lisp Modes.   Various modes for editing Lisp programs, with
  658.                        different facilities for running the Lisp programs.
  659. * Libraries: Lisp Libraries.      Creating Lisp programs to run in Emacs.
  660. * Eval: Lisp Eval.     Executing a single Lisp expression in Emacs.
  661. * Debug: Lisp Debug.   Debugging Lisp programs running in Emacs.
  662. * Interaction: Lisp Interaction.  Executing Lisp in an Emacs buffer.
  663. * External Lisp::      Communicating through Emacs with a separate Lisp.
  664.  
  665. 
  666. File: xemacs.info,  Node: Compilation,  Next: Lisp Modes,  Prev: Running,  Up: Running
  667.  
  668. Running "make", or Compilers Generally
  669. ======================================
  670.  
  671.    Emacs can run compilers for non-interactive languages like C and
  672. Fortran as inferior processes, feeding the error log into an Emacs
  673. buffer.  It can also parse the error messages and visit the files in
  674. which errors are found, moving point to the line where the error
  675. occurred.
  676.  
  677. `M-x compile'
  678.      Run a compiler asynchronously under Emacs, with error messages to
  679.      `*compilation*' buffer.
  680.  
  681. `M-x grep'
  682.      Run `grep' asynchronously under Emacs, with matching lines listed
  683.      in the buffer named `*compilation*'.
  684.  
  685. `M-x kill-compilation'
  686.      Kill the process made by the `M-x compile' command.
  687.  
  688. `M-x kill-grep'
  689.      Kill the running compilation or `grep' subprocess.
  690.  
  691. `C-x `'
  692.      Visit the next compiler error message or `grep' match.
  693.  
  694.    To run `make' or another compiler, type `M-x compile'.  This command
  695. reads a shell command line using the minibuffer, then executes the
  696. specified command line in an inferior shell with output going to the
  697. buffer named `*compilation*'.  By default, the current buffer's default
  698. directory is used as the working directory for the execution of the
  699. command; therefore, the makefile comes from this directory.
  700.  
  701.    When the shell command line is read, the minibuffer appears
  702. containing a default command line (the command you used the last time
  703. you typed `M-x compile').  If you type just <RET>, the same command
  704. line is used again.  The first `M-x compile' provides `make -k' as the
  705. default.  The default is taken from the variable `compile-command'; if
  706. the appropriate compilation command for a file is something other than
  707. `make -k', it can be useful to have the file specify a local value for
  708. `compile-command' (*note File Variables::.).
  709.  
  710.    When you start a compilation, the buffer `*compilation*' is
  711. displayed in another window but not selected.  Its mode line displays
  712. the word `run' or `exit' in the parentheses to tell you whether
  713. compilation is finished.  You do not have to keep this buffer visible;
  714. compilation continues in any case.
  715.  
  716.    To kill the compilation process, type `M-x-kill-compilation'.  The
  717. mode line of the `*compilation*' buffer changes to say `signal' instead
  718. of `run'.  Starting a new compilation also kills any running
  719. compilation, as only one can occur at any time.  Starting a new
  720. compilation prompts for confirmation before actually killing a
  721. compilation that is running.
  722.  
  723.    To parse the compiler error messages, type `C-x `' (`next-error').
  724. The character following `C-x' is the grave accent, not the single
  725. quote.  The command displays the buffer `*compilation*' in one window
  726. and the buffer in which the next error occurred in another window.
  727. Point in that buffer is moved to the line where the error was found.
  728. The corresponding error message is scrolled to the top of the window in
  729. which `*compilation*' is displayed.
  730.  
  731.    The first time you use `C-x `' after the start of a compilation, it
  732. parses all the error messages, visits all the files that have error
  733. messages, and creates markers pointing at the lines the error messages
  734. refer to.  It then moves to the first error message location.
  735. Subsequent uses of `C-x `' advance down the data set up by the first
  736. use.  When the preparsed error messages are exhausted, the next `C-x `'
  737. checks for any more error messages that have come in; this is useful if
  738. you start editing compiler errors while compilation is still going on.
  739. If no additional error messages have come in, `C-x `' reports an error.
  740.  
  741.    `C-u C-x `' discards the preparsed error message data and parses the
  742. `*compilation*' buffer again, then displays the first error.  This way,
  743. you can process the same set of errors again.
  744.  
  745.    Instead of running a compiler, you can run `grep' and see the lines
  746. on which matches were found.  To do this, type `M-x grep' with an
  747. argument line that contains the same arguments you would give to
  748. `grep': a `grep'-style regexp (usually in single quotes to quote the
  749. shell's special characters) followed by filenames, which may use
  750. wildcard characters.  The output from `grep' goes in the
  751. `*compilation*' buffer.  You can use `C-x `' to find the lines that
  752. match as if they were compilation errors.
  753.  
  754.    Note: a shell is used to run the compile command, but the shell is
  755. not run in interactive mode.  In particular, this means that the shell
  756. starts up with no prompt.  If you find your usual shell prompt making an
  757. unsightly appearance in the `*compilation*' buffer, it means you have
  758. made a mistake in your shell's initialization file (`.cshrc' or `.shrc'
  759. or ...) by setting the prompt unconditionally.  The shell
  760. initialization file should set the prompt only if there already is a
  761. prompt.  Here's how to do it in `csh':
  762.  
  763.      if ($?prompt) set prompt = ...
  764.  
  765. 
  766. File: xemacs.info,  Node: Lisp Modes,  Next: Lisp Libraries,  Prev: Compilation,  Up: Running
  767.  
  768. Major Modes for Lisp
  769. ====================
  770.  
  771.    Emacs has four different major modes for Lisp.  They are the same in
  772. terms of editing commands, but differ in the commands for executing Lisp
  773. expressions.
  774.  
  775. Emacs-Lisp mode
  776.      The mode for editing source files of programs to run in Emacs Lisp.
  777.      This mode defines `C-M-x' to evaluate the current defun.  *Note
  778.      Lisp Libraries::.
  779.  
  780. Lisp Interaction mode
  781.      The mode for an interactive session with Emacs Lisp.  It defines
  782.      <LFD> to evaluate the sexp before point and insert its value in the
  783.      buffer.  *Note Lisp Interaction::.
  784.  
  785. Lisp mode
  786.      The mode for editing source files of programs that run in other
  787.      dialects of Lisp than Emacs Lisp.  This mode defines `C-M-x' to
  788.      send the current defun to an inferior Lisp process.  *Note
  789.      External Lisp::.
  790.  
  791. Inferior Lisp mode
  792.      The mode for an interactive session with an inferior Lisp process.
  793.      This mode combines the special features of Lisp mode and Shell mode
  794.      (*note Shell Mode::.).
  795.  
  796. Scheme mode
  797.      Like Lisp mode but for Scheme programs.
  798.  
  799. Inferior Scheme mode
  800.      The mode for an interactive session with an inferior Scheme
  801.      process.
  802.  
  803. 
  804. File: xemacs.info,  Node: Lisp Libraries,  Next: Lisp Eval,  Prev: Lisp Modes,  Up: Running
  805.  
  806. Libraries of Lisp Code for Emacs
  807. ================================
  808.  
  809.    Lisp code for Emacs editing commands is stored in files whose names
  810. conventionally end in `.el'.  This ending tells Emacs to edit them in
  811. Emacs-Lisp mode (*note Lisp Modes::.).
  812.  
  813. * Menu:
  814.  
  815. * Loading::        Loading libraries of Lisp code into Emacs for use.
  816. * Compiling Libraries:: Compiling a library makes it load and run faster.
  817. * Mocklisp::        Converting Mocklisp to Lisp so XEmacs can run it.
  818.  
  819. 
  820. File: xemacs.info,  Node: Loading,  Next: Compiling Libraries,  Prev: Lisp Libraries,  Up: Lisp Libraries
  821.  
  822. Loading Libraries
  823. -----------------
  824.  
  825. `M-x load-file FILE'
  826.      Load the file FILE of Lisp code.
  827.  
  828. `M-x load-library LIBRARY'
  829.      Load the library named LIBRARY.
  830.  
  831. `M-x locate-library LIBRARY &optional NOSUFFIX'
  832.      Show the full path name of Emacs library LIBRARY.
  833.  
  834.    To execute a file of Emacs Lisp, use `M-x load-file'.  This command
  835. reads the file name you provide in the minibuffer, then executes the
  836. contents of that file as Lisp code.  It is not necessary to visit the
  837. file first; in fact, this command reads the file as found on disk, not
  838. the text in an Emacs buffer.
  839.  
  840.    Once a file of Lisp code is installed in the Emacs Lisp library
  841. directories, users can load it using `M-x load-library'.  Programs can
  842. load it by calling `load-library', or with `load', a more primitive
  843. function that is similar but accepts some additional arguments.
  844.  
  845.    `M-x load-library' differs from `M-x load-file' in that it searches
  846. a sequence of directories and tries three file names in each directory.
  847. The three names are: first, the specified name with `.elc' appended;
  848. second, the name with `.el' appended; third, the specified name alone.
  849. A `.elc' file would be the result of compiling the Lisp file into byte
  850. code;  if possible, it is loaded in preference to the Lisp file itself
  851. because the compiled file loads and runs faster.
  852.  
  853.    Because the argument to `load-library' is usually not in itself a
  854. valid file name, file name completion is not available.  In fact, when
  855. using this command, you usually do not know exactly what file name will
  856. be used.
  857.  
  858.    The sequence of directories searched by `M-x load-library' is
  859. specified by the variable `load-path', a list of strings that are
  860. directory names.  The elements of this list may not begin with "`~'",
  861. so you must call `expand-file-name' on them before adding them to the
  862. list.  The default value of the list contains the directory where the
  863. Lisp code for Emacs itself is stored.  If you have libraries of your
  864. own, put them in a single directory and add that directory to
  865. `load-path'.  `nil' in this list stands for the current default
  866. directory, but it is probably not a good idea to put `nil' in the list.
  867. If you start wishing that `nil' were in the list, you should probably
  868. use `M-x load-file' for this case.
  869.  
  870.    The variable is initialized by the EMACSLOADPATH environment
  871. variable. If no value is specified, the variable takes the default value
  872. specified in the file `paths.h' when Emacs was built. If a path isn't
  873. specified in `paths.h', a default value is obtained from the file
  874. system, near the directory in which the Emacs executable resides.
  875.  
  876.    Like `M-x load-library', `M-x locate-library' searches the
  877. directories in `load-path' to find the file that `M-x load-library'
  878. would load.  If the optional second argument NOSUFFIX is non-`nil', the
  879. suffixes `.elc' or `.el' are not added to the specified name LIBRARY
  880. (like calling `load' instead of `load-library').
  881.  
  882.    You often do not have to give any command to load a library, because
  883. the commands defined in the library are set up to "autoload" that
  884. library.  Running any of those commands causes `load' to be called to
  885. load the library; this replaces the autoload definitions with the real
  886. ones from the library.
  887.  
  888.    If autoloading a file does not finish, either because of an error or
  889. because of a `C-g' quit, all function definitions made by the file are
  890. undone automatically.  So are any calls to `provide'.  As a
  891. consequence, the entire file is loaded a second time if you use one of
  892. the autoloadable commands again.  This prevents problems when the
  893. command is no longer autoloading but is working incorrectly because the
  894. file was only partially loaded.  Function definitions are undone only
  895. for autoloading; explicit calls to `load' do not undo anything if
  896. loading is not completed.
  897.  
  898.    The variable `after-load-alist' takes an alist of expressions to be
  899. evaluated when particular files are loaded.  Each element has the form
  900. `(FILENAME forms...)'.  When `load' is run and the filename argument is
  901. FILENAME, the forms in the corresponding element are executed at the
  902. end of loading.
  903.  
  904.    FILENAME must match exactly.  Normally FILENAME is the name of a
  905. library, with no directory specified, since that is how load is
  906. normally called.  An error in `forms' does not undo the load, but it
  907. does prevent execution of the rest of the `forms'.
  908.  
  909. 
  910. File: xemacs.info,  Node: Compiling Libraries,  Next: Mocklisp,  Prev: Loading,  Up: Lisp Libraries
  911.  
  912. Compiling Libraries
  913. -------------------
  914.  
  915.    Emacs Lisp code can be compiled into byte-code which loads faster,
  916. takes up less space when loaded, and executes faster.
  917.  
  918. `M-x batch-byte-compile'
  919.      Run byte-compile-file on the files remaining on the command line.
  920.  
  921. `M-x byte-compile-buffer &optional BUFFER'
  922.      Byte-compile and evaluate contents of BUFFER (default is current
  923.      buffer).
  924.  
  925. `M-x byte-compile-file'
  926.      Compile a file of Lisp code named FILENAME into a file of byte
  927.      code.
  928.  
  929. `M-x byte-compile-and-load-file FILENAME'
  930.      Compile a file of Lisp code named FILENAME into a file of byte
  931.      code and load it.
  932.  
  933. `M-x byte-recompile-directory DIRECTORY'
  934.      Recompile every `.el' file in DIRECTORY that needs recompilation.
  935.  
  936. `M-x disassemble'
  937.      Print disassembled code for OBJECT on (optional) STREAM.
  938.  
  939. `M-x make-obsolete FUNCTION NEW'
  940.      Make the byte-compiler warn that FUNCTION is obsolete and NEW
  941.      should be used instead.
  942.  
  943.    `byte-compile-file' creates a byte-code compiled file from an
  944. Emacs-Lisp source file.  The default argument for this function is the
  945. file visited in the current buffer.  The function reads the specified
  946. file, compiles it into byte code, and writes an output file whose name
  947. is made by appending `c' to the input file name.  Thus, the file
  948. `rmail.el' would be compiled into `rmail.elc'. To compile a file of
  949. Lisp code named FILENAME into a file of byte code and then load it, use
  950. `byte-compile-and-load-file'. To compile and evaluate Lisp code in a
  951. given buffer, use `byte-compile-buffer'.
  952.  
  953.    To recompile all changed Lisp files in a directory, use `M-x
  954. byte-recompile-directory'.  Specify just the directory name as an
  955. argument.  Each `.el' file that has been byte-compiled before is
  956. byte-compiled again if it has changed since the previous compilation.
  957. A numeric argument to this command tells it to offer to compile each
  958. `.el' file that has not been compiled yet.  You must answer `y' or `n'
  959. to each offer.
  960.  
  961.    You can use the function `batch-byte-compile' to invoke Emacs
  962. non-interactively from the shell to do byte compilation.  When you use
  963. this function, the files to be compiled are specified with command-line
  964. arguments.  Use a shell command of the form:
  965.  
  966.      emacs -batch -f batch-byte-compile FILES...
  967.  
  968.    Directory names may also be given as arguments; in that case,
  969. `byte-recompile-directory' is invoked on each such directory.
  970. `batch-byte-compile' uses all remaining command-line arguments as file
  971. or directory names, then kills the Emacs process.
  972.  
  973.    `M-x disassemble' explains the result of byte compilation.  Its
  974. argument is a function name.  It displays the byte-compiled code in a
  975. help window in symbolic form, one instruction per line.  If the
  976. instruction refers to a variable or constant, that is shown, too.
  977.  
  978. 
  979. File: xemacs.info,  Node: Mocklisp,  Prev: Compiling Libraries,  Up: Lisp Libraries
  980.  
  981. Converting Mocklisp to Lisp
  982. ---------------------------
  983.  
  984.    XEmacs can run Mocklisp files by converting them to Emacs Lisp first.
  985. To convert a Mocklisp file, visit it and then type `M-x
  986. convert-mocklisp-buffer'.  Then save the resulting buffer of Lisp file
  987. in a file whose name ends in `.el' and use the new file as a Lisp
  988. library.
  989.  
  990.    You cannot currently byte-compile converted Mocklisp code.  The
  991. reason is that converted Mocklisp code uses some special Lisp features
  992. to deal with Mocklisp's incompatible ideas of how arguments are
  993. evaluated and which values signify "true" or "false".
  994.  
  995. 
  996. File: xemacs.info,  Node: Lisp Eval,  Next: Lisp Debug,  Prev: Lisp Libraries,  Up: Running
  997.  
  998. Evaluating Emacs-Lisp Expressions
  999. =================================
  1000.  
  1001.    Lisp programs intended to be run in Emacs should be edited in
  1002. Emacs-Lisp mode; this will happen automatically for file names ending in
  1003. `.el'.  By contrast, Lisp mode itself should be used for editing Lisp
  1004. programs intended for other Lisp systems.  Emacs-Lisp mode can be
  1005. selected with the command `M-x emacs-lisp-mode'.
  1006.  
  1007.    For testing of Lisp programs to run in Emacs, it is useful to be able
  1008. to evaluate part of the program as it is found in the Emacs buffer.  For
  1009. example, if you change the text of a Lisp function definition and then
  1010. evaluate the definition, Emacs installs the change for future calls to
  1011. the function.  Evaluation of Lisp expressions is also useful in any
  1012. kind of editing task for invoking non-interactive functions (functions
  1013. that are not commands).
  1014.  
  1015. `M-<ESC>'
  1016.      Read a Lisp expression in the minibuffer, evaluate it, and print
  1017.      the value in the minibuffer (`eval-expression').
  1018.  
  1019. `C-x C-e'
  1020.      Evaluate the Lisp expression before point, and print the value in
  1021.      the minibuffer (`eval-last-sexp').
  1022.  
  1023. `C-M-x'
  1024.      Evaluate the defun containing point or after point, and print the
  1025.      value in the minibuffer (`eval-defun').
  1026.  
  1027. `M-x eval-region'
  1028.      Evaluate all the Lisp expressions in the region.
  1029.  
  1030. `M-x eval-current-buffer'
  1031.      Evaluate all the Lisp expressions in the buffer.
  1032.  
  1033.    `M-<ESC>' (`eval-expression') is the most basic command for
  1034. evaluating a Lisp expression interactively.  It reads the expression
  1035. using the minibuffer, so you can execute any expression on a buffer
  1036. regardless of what the buffer contains.  When evaluation is complete,
  1037. the current buffer is once again the buffer that was current when
  1038. `M-<ESC>' was typed.
  1039.  
  1040.    `M-<ESC>' can easily confuse users, especially on keyboards with
  1041. autorepeat, where it can result from holding down the <ESC> key for too
  1042. long.  Therefore, `eval-expression' is normally a disabled command.
  1043. Attempting to use this command asks for confirmation and gives you the
  1044. option of enabling it; once you enable the command, you are no longer
  1045. required to confirm.  *Note Disabling::.
  1046.  
  1047.    In Emacs-Lisp mode, the key `C-M-x' is bound to the function
  1048. `eval-defun', which parses the defun containing point or following point
  1049. as a Lisp expression and evaluates it.  The value is printed in the echo
  1050. area.  This command is convenient for installing in the Lisp environment
  1051. changes that you have just made in the text of a function definition.
  1052.  
  1053.    The command `C-x C-e' (`eval-last-sexp') performs a similar job but
  1054. is available in all major modes, not just Emacs-Lisp mode.  It finds
  1055. the sexp before point, reads it as a Lisp expression, evaluates it, and
  1056. prints the value in the echo area.  It is sometimes useful to type in an
  1057. expression and then, with point still after it, type `C-x C-e'.
  1058.  
  1059.    If `C-M-x' or `C-x C-e' are given a numeric argument, they print the
  1060. value by inserting it into the current buffer at point, rather than in
  1061. the echo area.  The argument value does not matter.
  1062.  
  1063.    The most general command for evaluating Lisp expressions from a
  1064. buffer is `eval-region'.  `M-x eval-region' parses the text of the
  1065. region as one or more Lisp expressions, evaluating them one by one.
  1066. `M-x eval-current-buffer' is similar, but it evaluates the entire
  1067. buffer.  This is a reasonable way to install the contents of a file of
  1068. Lisp code that you are just ready to test.  After finding and fixing a
  1069. bug, use `C-M-x' on each function that you change, to keep the Lisp
  1070. world in step with the source file.
  1071.  
  1072. 
  1073. File: xemacs.info,  Node: Lisp Debug,  Next: Lisp Interaction,  Prev: Lisp Eval,  Up: Running
  1074.  
  1075. The Emacs-Lisp Debugger
  1076. =======================
  1077.  
  1078.    XEmacs contains a debugger for Lisp programs executing inside it.
  1079. This debugger is normally not used; many commands frequently get Lisp
  1080. errors when invoked in inappropriate contexts (such as `C-f' at the end
  1081. of the buffer) and it would be unpleasant to enter a special debugging
  1082. mode in this case.  When you want to make Lisp errors invoke the
  1083. debugger, you must set the variable `debug-on-error' to non-`nil'.
  1084. Quitting with `C-g' is not considered an error, and `debug-on-error'
  1085. has no effect on the handling of `C-g'.  However, if you set
  1086. `debug-on-quit' to be non-`nil', `C-g' will invoke the debugger.  This
  1087. can be useful for debugging an infinite loop; type `C-g' once the loop
  1088. has had time to reach its steady state.  `debug-on-quit' has no effect
  1089. on errors.
  1090.  
  1091.    You can make Emacs enter the debugger when a specified function is
  1092. called or at a particular place in Lisp code.  Use `M-x debug-on-entry'
  1093. with argument FUN-NAME to have Emacs enter the debugger as soon as
  1094. FUN-NAME is called. Use `M-x cancel-debug-on-entry' to make the
  1095. function stop entering the debugger when called.  (Redefining the
  1096. function also does this.)  To enter the debugger from some other place
  1097. in Lisp code, you must insert the expression `(debug)' there and
  1098. install the changed code with `C-M-x'.  *Note Lisp Eval::.
  1099.  
  1100.    When the debugger is entered, it displays the previously selected
  1101. buffer in one window and a buffer named `*Backtrace*' in another
  1102. window.  The backtrace buffer contains one line for each level of Lisp
  1103. function execution currently going on.  At the beginning of the buffer
  1104. is a message describing the reason that the debugger was invoked, for
  1105. example, an error message if it was invoked due to an error.
  1106.  
  1107.    The backtrace buffer is read-only and is in Backtrace mode, a special
  1108. major mode in which letters are defined as debugger commands.  The
  1109. usual Emacs editing commands are available; you can switch windows to
  1110. examine the buffer that was being edited at the time of the error, and
  1111. you can switch buffers, visit files, and perform any other editing
  1112. operations.  However, the debugger is a recursive editing level (*note
  1113. Recursive Edit::.); it is a good idea to return to the backtrace buffer
  1114. and explictly exit the debugger when you don't want to use it any more.
  1115. Exiting the debugger kills the backtrace buffer.
  1116.  
  1117.    The contents of the backtrace buffer show you the functions that are
  1118. executing and the arguments that were given to them.  It also allows you
  1119. to specify a stack frame by moving point to the line describing that
  1120. frame.  The frame whose line point is on is considered the "current
  1121. frame".  Some of the debugger commands operate on the current frame.
  1122. Debugger commands are mainly used for stepping through code one
  1123. expression at a time.  Here is a list of them:
  1124.  
  1125. `c'
  1126.      Exit the debugger and continue execution.  In most cases,
  1127.      execution of the program continues as if the debugger had never
  1128.      been entered (aside from the effect of any variables or data
  1129.      structures you may have changed while inside the debugger).  This
  1130.      includes entry to the debugger due to function entry or exit,
  1131.      explicit invocation, and quitting or certain errors.  Most errors
  1132.      cannot be continued; trying to continue an error usually causes
  1133.      the same error to occur again.
  1134.  
  1135. `d'
  1136.      Continue execution, but enter the debugger the next time a Lisp
  1137.      function is called.  This allows you to step through the
  1138.      subexpressions of an expression, and see what the subexpressions
  1139.      do and what values they compute.
  1140.  
  1141.      When you enter the debugger this way, Emacs flags the stack frame
  1142.      for the function call from which you entered.  The same function
  1143.      is then called when you exit the frame.  To cancel this flag, use
  1144.      `u'.
  1145.  
  1146. `b'
  1147.      Set up to enter the debugger when the current frame is exited.
  1148.      Frames that invoke the debugger on exit are flagged with stars.
  1149.  
  1150. `u'
  1151.      Don't enter the debugger when the current frame is exited.  This
  1152.      cancels a `b' command on a frame.
  1153.  
  1154. `e'
  1155.      Read a Lisp expression in the minibuffer, evaluate it, and print
  1156.      the value in the echo area.  This is equivalent to the command
  1157.      `M-<ESC>', except that `e' is not normally disabled like `M-<ESC>'.
  1158.  
  1159. `q'
  1160.      Terminate the program being debugged; return to top-level Emacs
  1161.      command execution.
  1162.  
  1163.      If the debugger was entered due to a `C-g' but you really want to
  1164.      quit, not to debug, use the `q' command.
  1165.  
  1166. `r'
  1167.      Return a value from the debugger.  The value is computed by
  1168.      reading an expression with the minibuffer and evaluating it.
  1169.  
  1170.      The value returned by the debugger makes a difference when the
  1171.      debugger was invoked due to exit from a Lisp call frame (as
  1172.      requested with `b'); then the value specified in the `r' command
  1173.      is used as the value of that frame.
  1174.  
  1175.      The debugger's return value also matters with many errors.  For
  1176.      example, `wrong-type-argument' errors will use the debugger's
  1177.      return value instead of the invalid argument; `no-catch' errors
  1178.      will use the debugger value as a throw tag instead of the tag that
  1179.      was not found.  If an error was signaled by calling the Lisp
  1180.      function `signal', the debugger's return value is returned as the
  1181.      value of `signal'.
  1182.  
  1183.